<template>
	<div>
		<ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="item in items" :key="item.id">
					<router-link :to="'/home/newsinfo/'+ item.id">
						<img class="mui-media-object mui-pull-left" :src="item.author.avatar_url">
						<div class="mui-media-body">
							{{item.title}}
						<p class="mui-ellipsis">
						<span>发表时间：{{item.last_reply_at | dataFormat('YYYY-MM-DD')}}</span>
						<span>点击次数：1次</span>
						</p>
						</div>
					</router-link>
				</li>

			</ul>
	</div>
</template>

<script>
	export default {
		data() {
			return {
                items: [
					
				]
			};
		},
		created() {
			 this.getnews();
		},
		methods: {
			getnews() {
				this.$http.get('https://cnodejs.org/api/v1/topics', {
					params: { //参数
						page: this.page,
					 	limit: this.limit,
						id: this.id,
					},
				}).then(res => { //请求成功后的处理函数     
					this.isLoading = false;
					this.items = res.data.data;
					// console.log(this.items);
				}).catch(err => { //请求失败后的处理函数   
					console.log(err)
				})
			}
		}
	}
</script>

<style>
	.mui-ellipsis{
		font-size: 12px;
		color: #007AFF;
		display: flex;
		justify-content: space-between;
	}
</style>
